package com.example.day12_7_12_2.actitivty;

import android.os.Message;
import android.view.LayoutInflater;
import android.view.View;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;

import com.example.day12_7_12_2.adapter.InfoRclAdapter;
import com.example.day12_7_12_2.base.BaseActivity;
import com.example.day12_7_12_2.bean.NaviBean;
import com.example.day12_7_12_2.databinding.ActivityMainBinding;
import com.example.day12_7_12_2.presenter.IPresenter;
import com.example.day12_7_12_2.view.IView;

import android.os.Handler;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends BaseActivity implements IView<NaviBean> {
    private ActivityMainBinding root;
    private InfoRclAdapter infoRclAdapter;

    @Override
    protected IPresenter initPresenter() {
        return new IPresenter();
    }

    @Override
    protected void initData() {
        iPresenter.getData();
    }

    @Override
    protected void initView() {
        root.rcl.setLayoutManager(new LinearLayoutManager(this));
        List<NaviBean.DataBean> list  = new ArrayList<>();
        infoRclAdapter = new InfoRclAdapter(this, list);
        root.rcl.setAdapter(infoRclAdapter);
    }

    @Override
    protected View getLayout() {
        root = ActivityMainBinding.inflate(LayoutInflater.from(this));
        return root.getRoot();
    }
    @Override
    public void setData(NaviBean naviBean) {
        infoRclAdapter.addData(naviBean.getData());
    }
}
